import Vue from 'vue'
import i18n from './Lang'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import '@/icons'
import '@/permission'
import pageTools from '@/components'
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }
Vue.use(pageTools)
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.prototype.$checkPoint = function(pointKey) {
  if (store.state.user.userInfo.roles && store.state.user.userInfo.roles.points) {
    // 进行权限点判断
    // return console.log(store.state.user.userInfo.roles.points)
    return store.state.user.userInfo.roles.points.includes(pointKey)
  }
  // 如果没有权限点信息,说明用户没有身份,没有任何权限
  return false
}
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
